package com.bank.dao;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.bank.entity.Bookkeeping;

@Repository
public class BookkeepingDao  extends BaseDao{

	Logger logger = Logger.getLogger(BookkeepingDao.class);
	
	
	@Autowired
	private SessionFactory sessionFactory;     /*sessiion 工厂*/
	@SuppressWarnings("unchecked") 
	public List<Bookkeeping> getBookkeepingInfo(String trans_code){
		Session session = sessionFactory.getCurrentSession();
		String sql  = "from Bookkeeping   where config_transcode='"+trans_code+"'   ";
		Query query = session.createQuery(sql);
		List<Bookkeeping> list = query.list();
		for(Bookkeeping bookkeeping:list){
			logger.debug("Bookkeeping.sequence"+bookkeeping.getSequence());
		}
		
		return list;
	}
}
